import request from './request'

export const dailyHomeworkApi = {
  // 获取所有日常作业
  getAll() {
    return request.get('/daily-homework')
  },

  // 获取启用的日常作业
  getActive() {
    return request.get('/daily-homework/active')
  },

  // 创建日常作业
  create(data) {
    return request.post('/daily-homework', data)
  },

  // 更新日常作业
  update(id, data) {
    return request.put(`/daily-homework/${id}`, data)
  },

  // 删除日常作业
  delete(id) {
    return request.delete(`/daily-homework/${id}`)
  },

  // 启用/禁用日常作业
  toggle(id, isActive) {
    return request.put(`/daily-homework/${id}/toggle`, null, {
      params: { isActive }
    })
  },

  // 调整排序
  reorder(ids) {
    return request.put('/daily-homework/reorder', ids)
  }
}